package com.hzx.intercepter;

import org.apache.struts2.ServletActionContext;

import com.hzx.entity.User;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class LoginIntercepter extends MethodFilterInterceptor{

	@Override
	protected String doIntercept(ActionInvocation invoction) throws Exception {
		User user = (User) ServletActionContext.getRequest().getSession().getAttribute("userInfo");
		if(user != null){
			//已登录
			return invoction.invoke();
		}
		return "login";
	}

}
